package com.atXiao.food.strategy.pay;

/**
 * @author: lixiaoxiao
 * @date: 2024/1/11 11:43
 * @version: 1.0
 * @desc:
 */
abstract class Payment {



    /**
     * 支付
     */
    public Result doPayment(Double amount) {

        if (queryBalance() < amount) {
            return new Result(500, "fail", "余额不足");
        }
        System.out.println("当前支付通道:"+getPaymentChannel());
        //TOOD 执行扣款逻辑
        System.out.println("正在进行扣款支付");
        return new Result(200, "success", "支付成功");
    }

    public abstract String getPaymentChannel();



    /**
     * 余额查询
     *
     * @return
     */
    public abstract Double queryBalance();


}
